package com.zhuss.product.preline;

import com.zhuss.bean.bo.product.preline.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.zhuss.common.OperateService;
import com.zhuss.common.Processor;
import com.zhuss.exception.DzcxException;

/**
 * @description: 招募操作的Service
 * @author: mkh
 * @create: Mon Jan 04 13:38:02 CST 2021
 **/
@Component("prelineOperateService")
public class PrelineOperateService implements OperateService<Void, Object> {
	
	@Autowired
	@Qualifier("prelineCreate")
	private Processor<Object, CreatePrelineBo> prelineCreate;
	
	@Autowired
	@Qualifier("prelineUpdate")
	private Processor<Object, UpdatePrelineBo> prelineUpdate;
	
	@Autowired
	@Qualifier("prelineDelete")
	private Processor<Object, DeletePrelineBo> prelineDelete;
	@Autowired
	@Qualifier("prelineBind")
	private Processor<Object, BindPrelineBo> prelineBind;
	@Autowired
	@Qualifier("prelineStart")
	private Processor<Object, StartPrelineBo> lineStart;
	@Autowired
	@Qualifier("prelineStop")
	private Processor<Object, StopPrelineBo> lineStop;
	/**
	 * 创建
	 */
	@Override
    @Transactional(rollbackFor = Exception.class)
	public Void create(Object param) throws DzcxException {
		
		CreatePrelineBo bo = (CreatePrelineBo) param;
		
		prelineCreate.process(bo);
		
		return null;
	}
    
	/**
	 * 修改
	 */
	@Override
    @Transactional(rollbackFor = Exception.class)
    public Void update(Object param) throws DzcxException {
    	
		UpdatePrelineBo bo = (UpdatePrelineBo) param;
		
		prelineUpdate.process(bo);
		
    	return null;
    }
	
	/**
	 * 删除
	 */
	@Override
	@Transactional(rollbackFor = Exception.class)
	public Void delete(Object param) throws DzcxException {
		
		DeletePrelineBo bo = (DeletePrelineBo) param;
		
		prelineDelete.process(bo);
		
		return null;
	}

	/**
	 * 
	 * @param param
	 * @return
	 * @throws DzcxException
	 */
	public Void bind(Object param) throws DzcxException {
		BindPrelineBo bo = (BindPrelineBo) param;
		prelineBind.process(bo);
		return null;
	}
	/**
	 * 启用
	 */
	@Transactional(rollbackFor = Exception.class)
	protected Void start(Object param) throws DzcxException {

		StartPrelineBo bo = (StartPrelineBo) param;

		lineStart.process(bo);

		return null;
	}

	/**
	 * 停用
	 */
	@Transactional(rollbackFor = Exception.class)
	protected Void stop(Object param) throws DzcxException {

		StopPrelineBo bo = (StopPrelineBo) param;
		lineStop.process(bo);

		return null;
	}
}

